package com.example.editlist;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class PopListAdapter extends BaseAdapter {
    @SuppressWarnings("unused")
    private Context context;
    private ArrayList<String> list =new ArrayList<String>();
    private LayoutInflater inflater;

    public PopListAdapter(Context c,ArrayList<String> pList

                     ,LayoutInflater layoutInflater){
             this.context= c;
             this.list= pList;
             //inflater = (LayoutInflater)context.

                 //getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             this.inflater= layoutInflater;
   }

  @Override
  public int getCount() {
       return list.size();
   }

  @Override
  public Object getItem(int arg0) {
         return list.get(arg0);
   }

  @Override
  public long getItemId(int arg0) {
        return arg0;
  }

  @Override
  public View getView(int index, View view, ViewGroup arg2) {
         try {
             view = inflater.inflate(R.layout.location_search_result_item,null);
             ((TextView) view.findViewById(R.location_search_result_item_id.tvLocation))
                  . setText(list.get(index));
        } catch (Exception e) {

        }
        return view;
 }


}
